package br.ucb.sigplan.action.impl;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import br.ucb.sigplan.action.Action;
import br.ucb.sigplan.beans.Conteudo;
import br.ucb.sigplan.crud.ConteudoCrud;

public class AbrirCadastraConteudoTurmaAction implements Action {

	@Override
	public String execute(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		HttpSession session = req.getSession();
		Integer idTurma = new Integer(req.getParameter("idTurma"));
		List<Conteudo> conteudos = ConteudoCrud.findByTipo('C');
		session.setAttribute("conteudos", conteudos);
		session.setAttribute("conteudosTurma", new ArrayList<Conteudo>());
		session.setAttribute("turma", idTurma);
		return "/jsp/professor/conteudo/profCadastraConteudoTurma.jsp";
	}
}
